FROM docker.elastic.co/elasticsearch/elasticsearch:7.9.3

ENV TMP_PATH /tmp
ENV BIN_PATH /usr/share/elasticsearch/bin
ENV PLUGIN_PATH /usr/share/elasticsearch/plugins
ENV IK_VERSION 7.9.3
ENV PINYIN_VERSION 7.9.3

COPY elasticsearch-analysis-ik-${IK_VERSION}.zip ${TMP_PATH}
COPY elasticsearch-analysis-pinyin-${PINYIN_VERSION}.zip ${TMP_PATH}

RUN ${BIN_PATH}/elasticsearch-plugin install --batch file://${TMP_PATH}/elasticsearch-analysis-ik-${IK_VERSION}.zip
RUN unzip ${TMP_PATH}/elasticsearch-analysis-pinyin-${PINYIN_VERSION}.zip -d ${PLUGIN_PATH}/pinyin

EXPOSE 9200 9300